package com.neusoft.elmboot.service.Impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.neusoft.elmboot.mapper.IntegrationlogMapper;
import com.neusoft.elmboot.po.Integrationlog;
import com.neusoft.elmboot.service.IntegrationlogService;
import com.neusoft.elmboot.util.CommonUtil;

@Service
public class IntegrationlogServiceImpl implements IntegrationlogService{

    @Autowired
    IntegrationlogMapper integrationlogMapper;

    @Override
    public int getIntegrationlogByUserIdByTime(String userId) {
        return integrationlogMapper.getIntegrationlogByUserIdByTime(userId, CommonUtil.getCurrentDate());
    }

    @Override
    public int saveIntegrationlogByPay(Integrationlog il) {
        il.setTime(CommonUtil.getCurrentDate());
        return integrationlogMapper.saveIntegrationlogByPay(il);
    }
    
    @Override
    public int deleteIntegrationlogByUserIdByTime(String userId, Integer count) {
    	return integrationlogMapper.deleteIntegrationlogByUserIdByTime(userId, count);
    }
    
    @Override
    public int updateIntegrationlog(String userId) {
    	return integrationlogMapper.updateIntegrationlog(userId, CommonUtil.getPreviousDate());
    }
    
    @Override
    public int getExpirationIntegrationlogByUserId(String userId) {
    	String limitTime = CommonUtil.getExpirationDate();
    	return integrationlogMapper.getExpirationIntegrationlogByUserId(userId, limitTime);
    }
}
